<html>
<head>
    <title>常用指令：v-show</title>
    <script src="js/vue.js"></script>
    <script>
        window.onload = function() {
            let vm = new Vue({
                el: '#itany', 
                data: { // 存储数据
                    flag: true
                },
                methods: { // 存储方法
                    hideDiv() {
                        this.flag = false; 
                    }
                } 
            }); 
        }
    </script>
</head>
<body>
    <div id="itany">
        <button v-on:click="hideDiv">隐藏</button>
        <button v-on:click="flag=true">显示</button>
        <div style="width:100px; height:100px; background-color:red" v-show="flag">欢迎学习vue</div>

        <hr>

        <div style="width:100px; height:100px; background-color:red" v-if="flag">欢迎学习vue</div>
    </div>
</body>
</html>
